<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center examinationRes_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub examinationRes_fd0_0'>
					<view class='flex flex-wrap align-center examinationRes_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  examinationRes_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='examinationRes_fd0_0_c1_c0'>{{$t('结果统计')}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end examinationRes_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout examinationRes_flex_1">
				<view class='flex flex-wrap align-center examinationRes_fd1_0'>
					<view class=" examinationRes_fd1_0_c0">
						<qiun-data-charts v-if="shows" :canvas2d='true' :reshow='true' :chartData="chartsOptsfd1_0_c0"
							:ontouch='true' chart-type='6' type='ring' :opts='chartsOptsfd1_0_c0' />
					</view>
					<view class='flex flex-wrap align-center justify-between examinationRes_fd1_0_c1'>
						<view @click="goError"
							class='flex flex-direction flex-wrap align-center self-center justify-around examinationRes_fd1_0_c1_c0'>
							<view class='flex flex-wrap align-center'>
								<text style="color: #4781f5;" class='examinationRes_fd1_0_c1_c0_c0_c0'>{{error}}</text>
								<text class='examinationRes_fd1_0_c1_c0_c0_c1'>个</text>
							</view>
							<text class='examinationRes_fd1_0_c1_c0_c1'>错题</text>
						</view>
						<view
							class='flex flex-direction flex-wrap align-center self-center justify-around examinationRes_fd1_0_c1_c0'>
							<view class='flex flex-wrap align-center'>
								<text class='examinationRes_fd1_0_c1_c0_c0_c0'>{{accuracy}}</text>
							</view>
							<text class='examinationRes_fd1_0_c1_c0_c1'>正确率</text>
						</view>
					</view>
				</view>
			</view>
			<!---flex布局flex布局结束-->
			<!-- 	<view class="flex benben-position-layout flex flex-wrap align-center examinationRes_flex_2"
				@click="goBackHandle"
				:style="{height:(110+bottomSafeAreaRpx)+'rpx',paddingBottom:bottomSafeAreaRpx+'rpx', }">
				<button class='examinationRes_fd2_0' data-type="back" data-url="1">{{$t('重新预习')}}</button>
			</view> -->
			<view :style="{height: (110+bottomSafeAreaRpx)+'rpx'}"></view>
		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},
		data() {
			return {
				shows: false,
				percent: 0,
				accuracy: '',
				error: "",
				"chartsOptsfd1_0_c0": {
					"padding": [5, 5, 5, 5],
					"dataLabel": false,
					"enableScroll": false,
					"legend": {
						"show": true,
						"position": "right",
						"lineHeight": 30,
						"fontSize": 15
					},
					"title": {
						"name": "正确",
						"fontSize": 15,
						"color": "#666666"
					},
					"subtitle": {
						"name": "3",
						"fontSize": 20,
						"color": "#7cb5ec"
					},
					"extra": {
						"ring": {
							"ringWidth": 20,
							"activeOpacity": 0.5,
							"activeRadius": 10,
							"offsetAngle": 0,
							"labelWidth": 15,
							"border": false,
							"borderWidth": 3,
							"borderColor": "#FFFFFF"
						}
					}
				},
				"aid": "",
				"chapter_id": ""
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.chapter_id = options.chapter_id
			this.getjd6f37a7c752efFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			let that = this;
			var s = setInterval(item => {
				if (that.percent <= 99) {
					that.percent++
				} else {
					clearInterval(s)
				}
			}, 150)
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			goError() {
				uni.navigateTo({
					url: `/pages/course/answer/answer?chapter_id=${this.chapter_id}&type=6`
				})
			},
			//查看答题结果统计 --章节
			async getjd6f37a7c752efFunc() {
				let res = await this.$api.get(global.apiUrls.post680ef6837db6d3ec90, {
					chapter_id: this.chapter_id
				});

				console.log(',,,,,,,,,,,,,', res);

				if (res.data.code != 1) {
					this.$message.info(res.data.msg);
					return
				}

				this.accuracy = res.data.data.accuracy

				this.chartsOptsfd1_0_c0.series = [{
						"data": res.data.data.not_answer,
						"name": "未答"
					},
					{
						"data": res.data.data.error,
						"name": "错误"
					},
					{
						"data": res.data.data.correct,
						"name": "正确"
					}
				]

				this.chartsOptsfd1_0_c0.subtitle.name = res.data.data.correct
				this.error = res.data.data.error
				this.shows = true
				this.$forceUpdate()
			},

			goBackHandle() {
				uni.navigateBack(1)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.MyPortrayal_fd1_7_c1_c1 {
		background: #f3f6f8;
		border-radius: 16rpx;
		background-size: 100% auto;
		padding: 24rpx;
	}

	.MyPortrayal_fd1_7_c1_c0_c2_c0 {
		font-size: 24rpx;
		color: #333;
		font-weight: 500;
		line-height: 33rpx;
	}

	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.examinationRes_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.examinationRes_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 700;
		color: #333333;
		line-height: 50rpx;
	}

	.examinationRes_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.examinationRes_fd0_0_c0 {
		width: 120rpx;
	}

	.examinationRes_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.examinationRes_flex_1 {
		padding: 24rpx;
	}

	::v-deep .examinationRes_fd1_1_c0_c2 {
		width: 100%;
	}

	.examinationRes_fd1_1_c0_c1_c2_c0 {
		color: #333;
		font-size: 24rpx;
		font-weight: 500;
	}

	.examinationRes_progress1_fd1_1_c0_c1_c1_c0 {
		background: #145EFD;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
	}

	.examinationRes_fd1_1_c0_c1_c1_c0 {
		border: 1px solid rgba(20, 94, 253, 0.1);
		background: rgba(20, 94, 253, 0.10);
		width: 300rpx;
		height: 20rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 24rpx 0rpx 24rpx 0rpx;
		background-size: 100% auto;
	}

	.examinationRes_fd1_1_c0_c1_c0_c1 {
		font-size: 32rpx;
		color: rgba(20, 94, 253, 1);
	}

	.examinationRes_fd1_1_c0_c1_c0_c0 {
		font-size: 48rpx;
		color: rgba(20, 94, 253, 1);
		font-weight: 700;
		line-height: 60rpx;
	}

	.examinationRes_fd1_1_c0_c1 {
		width: 100%;
		height: 300rpx;
	}

	.examinationRes_fd1_1_c0_c0 {
		width: 100%;
		margin: 0rpx 0rpx 24rpx 0rpx;
		color: rgba(20, 94, 253, 1);
		font-size: 28rpx;
		font-weight: 500;
		line-height: 48rpx;
	}

	.examinationRes_fd1_1_c0 {
		background: #f3f6f8;
		width: 100%;
		padding: 24rpx;
		background-size: 100% auto;
		border-radius: 16rpx;
	}

	.examinationRes_fd1_1 {
		background: var(--benbenbgColor1);
		margin: 0rpx 0rpx 24rpx 0rpx;
		padding: 24rpx;
		background-size: 100% auto;
		border-radius: 32rpx;
	}

	.examinationRes_fd1_0_c1_c0_c1 {
		color: rgba(102, 102, 102, 1);
		line-height: 48rpx;
	}

	.examinationRes_fd1_0_c1_c0_c0_c1 {
		color: #333;
		font-size: 28rpx;
		font-weight: 700;
	}

	.examinationRes_fd1_0_c1_c0_c0_c0 {
		color: #333;
		font-size: 48rpx;
		font-weight: 700;
		font-style: inherit;
	}

	.examinationRes_fd1_0_c1_c0 {
		background: #F3F6F8;
		height: 100%;
		width: 316rpx;
		background-size: 100% auto;
		border-radius: 16rpx;
	}

	.examinationRes_fd1_0_c1 {
		margin: 24rpx 0rpx 0rpx 0rpx;
		width: 100%;
		height: 162rpx;
	}

	.examinationRes_fd1_0_c0 {
		width: 100%;
		height: 274rpx;
	}

	.examinationRes_fd1_0 {
		background: var(--benbenbgColor1);
		margin: 0rpx 0rpx 24rpx 0rpx;
		padding: 24rpx;
		background-size: 100% auto;
		border-radius: 32rpx;
		width: 100%;
	}

	.examinationRes_flex_2 {
		width: 100%;
		height: 110rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
	}

	.examinationRes_fd2_0 {
		background: #4781f5;
		width: 100%;
		line-height: 110rpx;
		font-size: 32rpx;
		color: #fff;
		border-radius: 0rpx;
	}
</style>